<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Rotates the object in global coordinates</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="swfdisplayitem.rotate.html">SWFDisplayItem::rotate</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="swfdisplayitem.scale.html">SWFDisplayItem::scale</a></div>
 <div class="up"><a href="class.swfdisplayitem.html">SWFDisplayItem</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="swfdisplayitem.rotateto" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SWFDisplayItem::rotateTo</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.5)</p><p class="refpurpose"><span class="refname">SWFDisplayItem::rotateTo</span> &mdash; <span class="dc-title">Rotates the object in global coordinates</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-swfdisplayitem.rotateto-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>SWFDisplayItem::rotateTo</strong></span>
    ( <span class="methodparam"><span class="type">float</span> <code class="parameter">$angle</code></span>
   )</div>

  <div class="warning"><strong class="warning">Warning</strong><p class="simpara">此函数是<em class="emphasis">实验性</em>的。此函数的表象，包括名称及其相关文档都可能在未来的
PHP 发布版本中未通知就被修改。使用本函数风险自担 。</p></div>
  <p class="para">
   <span class="function"><strong>swfdisplayitem::rotateto()</strong></span> set the current object
   rotation to <em><code class="parameter">angle</code></em> degrees in global coordinates.
  </p>
  <p class="simpara">
   The object may be a <span class="function"><strong>swfshape()</strong></span>, a 
   <span class="function"><strong>swfbutton()</strong></span>, a <span class="function"><strong>swftext()</strong></span> or a 
   <span class="function"><strong>swfsprite()</strong></span> object. It must have been added using
   the <span class="function"><a href="swfmovie.add.html" class="function">swfmovie::add()</a></span>.
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-swfdisplayitem.rotateto-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   没有返回值。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-swfdisplayitem.rotateto-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   This example bring three rotating string from the background to the
   foreground. Pretty nice.
   <div class="example" id="example-3453">
    <p><strong>Example #1 <span class="function"><strong>swfdisplayitem::rotateto()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$thetext&nbsp;</span><span style="color: #007700">=&nbsp;&nbsp;</span><span style="color: #DD0000">"ming!"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$f&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SWFFont</span><span style="color: #007700">(</span><span style="color: #DD0000">"Bauhaus&nbsp;93.fdb"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$m&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SWFMovie</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setRate</span><span style="color: #007700">(</span><span style="color: #0000BB">24.0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setDimension</span><span style="color: #007700">(</span><span style="color: #0000BB">2400</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1600</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setBackground</span><span style="color: #007700">(</span><span style="color: #0000BB">0xff</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xff</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xff</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;functions&nbsp;with&nbsp;huge&nbsp;numbers&nbsp;of&nbsp;arbitrary<br />//&nbsp;arguments&nbsp;are&nbsp;always&nbsp;a&nbsp;good&nbsp;idea!&nbsp;&nbsp;Really!<br /><br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">text</span><span style="color: #007700">(</span><span style="color: #0000BB">$r</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$g</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$b</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$a</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$rot</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$x</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$y</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$scale</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$string</span><span style="color: #007700">)&nbsp;<br />{<br />&nbsp;&nbsp;global&nbsp;</span><span style="color: #0000BB">$f</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$m</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;</span><span style="color: #0000BB">$t&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SWFText</span><span style="color: #007700">();<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$t</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setFont</span><span style="color: #007700">(</span><span style="color: #0000BB">$f</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$t</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setColor</span><span style="color: #007700">(</span><span style="color: #0000BB">$r</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$g</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$b</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$a</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$t</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setHeight</span><span style="color: #007700">(</span><span style="color: #0000BB">960</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$t</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">moveTo</span><span style="color: #007700">(-(</span><span style="color: #0000BB">$f</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getWidth</span><span style="color: #007700">(</span><span style="color: #0000BB">$string</span><span style="color: #007700">))/</span><span style="color: #0000BB">2</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$f</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getAscent</span><span style="color: #007700">()/</span><span style="color: #0000BB">2</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$t</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addString</span><span style="color: #007700">(</span><span style="color: #0000BB">$string</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;we&nbsp;can&nbsp;add&nbsp;properties&nbsp;just&nbsp;like&nbsp;a&nbsp;normal&nbsp;PHP&nbsp;var,<br />&nbsp;&nbsp;//&nbsp;as&nbsp;long&nbsp;as&nbsp;the&nbsp;names&nbsp;aren't&nbsp;already&nbsp;used.<br />&nbsp;&nbsp;//&nbsp;e.g.,&nbsp;we&nbsp;can't&nbsp;set&nbsp;$i-&gt;scale,&nbsp;because&nbsp;that's&nbsp;a&nbsp;function<br /><br />&nbsp;&nbsp;</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">add</span><span style="color: #007700">(</span><span style="color: #0000BB">$t</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">x&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$x</span><span style="color: #007700">;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">y&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$y</span><span style="color: #007700">;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">rot&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$rot</span><span style="color: #007700">;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">s&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$scale</span><span style="color: #007700">;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">rotateTo</span><span style="color: #007700">(</span><span style="color: #0000BB">$rot</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">scale</span><span style="color: #007700">(</span><span style="color: #0000BB">$scale</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$scale</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;but&nbsp;the&nbsp;changes&nbsp;are&nbsp;local&nbsp;to&nbsp;the&nbsp;function,&nbsp;so&nbsp;we&nbsp;have&nbsp;to<br />&nbsp;&nbsp;//&nbsp;return&nbsp;the&nbsp;changed&nbsp;object.&nbsp;&nbsp;kinda&nbsp;weird..<br /><br />&nbsp;&nbsp;</span><span style="color: #007700">return&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">;<br />}<br /><br />function&nbsp;</span><span style="color: #0000BB">step</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">)&nbsp;<br />{<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$oldrot&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">rot</span><span style="color: #007700">;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">rot&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">19</span><span style="color: #007700">*</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">rot</span><span style="color: #007700">/</span><span style="color: #0000BB">20</span><span style="color: #007700">;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">x&nbsp;</span><span style="color: #007700">=&nbsp;(</span><span style="color: #0000BB">19</span><span style="color: #007700">*</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">x&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">1200</span><span style="color: #007700">)/</span><span style="color: #0000BB">20</span><span style="color: #007700">;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">y&nbsp;</span><span style="color: #007700">=&nbsp;(</span><span style="color: #0000BB">19</span><span style="color: #007700">*</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">y&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">800</span><span style="color: #007700">)/</span><span style="color: #0000BB">20</span><span style="color: #007700">;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">s&nbsp;</span><span style="color: #007700">=&nbsp;(</span><span style="color: #0000BB">19</span><span style="color: #007700">*</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">s&nbsp;</span><span style="color: #007700">+&nbsp;</span><span style="color: #0000BB">1.0</span><span style="color: #007700">)/</span><span style="color: #0000BB">20</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">rotateTo</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">rot</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">scaleTo</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">s</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">s</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">moveTo</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">x</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">y</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #FF8000">//&nbsp;see?&nbsp;&nbsp;it&nbsp;sure&nbsp;paid&nbsp;off&nbsp;in&nbsp;legibility:<br /><br /></span><span style="color: #0000BB">$i1&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">text</span><span style="color: #007700">(</span><span style="color: #0000BB">0xff</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x33</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x33</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xff</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">900</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1200</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">800</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0.03</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$thetext</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$i2&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">text</span><span style="color: #007700">(</span><span style="color: #0000BB">0x00</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x33</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xff</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x7f</span><span style="color: #007700">,&nbsp;-</span><span style="color: #0000BB">560</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1200</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">800</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0.04</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$thetext</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$i3&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">text</span><span style="color: #007700">(</span><span style="color: #0000BB">0xff</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xff</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0xff</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0x9f</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">180</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1200</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">800</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0.001</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$thetext</span><span style="color: #007700">);<br /><br />for&nbsp;(</span><span style="color: #0000BB">$i</span><span style="color: #007700">=</span><span style="color: #0000BB">1</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">&lt;=</span><span style="color: #0000BB">100</span><span style="color: #007700">;&nbsp;++</span><span style="color: #0000BB">$i</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$i1&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">step</span><span style="color: #007700">(</span><span style="color: #0000BB">$i1</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$i2&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">step</span><span style="color: #007700">(</span><span style="color: #0000BB">$i2</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$i3&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">step</span><span style="color: #007700">(</span><span style="color: #0000BB">$i3</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;</span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">nextFrame</span><span style="color: #007700">();<br />}<br /><br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-type:&nbsp;application/x-shockwave-flash'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$m</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">output</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-swfdisplayitem.rotateto-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="swfdisplayitem.rotate.html" class="function" rel="rdfs-seeAlso">SWFDisplayItem::rotate()</a> - Rotates in relative coordinates</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="swfdisplayitem.rotate.html">SWFDisplayItem::rotate</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="swfdisplayitem.scale.html">SWFDisplayItem::scale</a></div>
 <div class="up"><a href="class.swfdisplayitem.html">SWFDisplayItem</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
